<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hzb.erp.api.pc.student.mapper.StudentLessonCountLogMapper">

    <select id="getList" resultType="com.hzb.erp.api.pc.student.pojo.StudentLessonCountLogVO">
        SELECT t1.*,
        t2.name student_name,
        t3.name course_name,
        t4.name staff_name,
        t5.date,
        t5.start_time,
        t5.state as lesson_state
        FROM student_lesson_count_log t1
        LEFT JOIN lesson t5 on t5.id = t1.lesson_id
        LEFT JOIN student t2 on t2.id = t1.student_id
        LEFT JOIN course t3 on t3.id = t1.course_id
        LEFT JOIN staff t4 on t4.id = t1.staff_id
        <where>
            <if test="param.studentId != null">
                AND t1.student_id = #{param.studentId}
            </if>
        </where>
        order by t1.id desc
    </select>
</mapper>
